unit UFrmprotec;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, jpeg, ExtCtrls;

type
  TFrmprotec = class(TForm)
    Image1: TImage;
    Function GetStateK (Key: integer): boolean;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure FormShow(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  private

    { Private declarations }
  public
    { Public declarations }
  end;

var
  Frmprotec: TFrmprotec;
  fechar: Boolean;

implementation

uses UFrmContador;

{$R *.DFM}

Function TFrmprotec.GetStateK (Key: integer): boolean;
begin
Result := Odd (GetKeyState (Key));
end;

procedure TFrmprotec.FormClose(Sender: TObject; var Action: TCloseAction);
begin
//  If Not fechar Then
//     Action := caNone
//  Else
//     Action := caFree;
end;

procedure TFrmprotec.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
If GetStateK (VK_LMENU) And (Key = VK_F4) Then
  fechar := False;
end;

procedure TFrmprotec.FormShow(Sender: TObject);
var
OldValue : LongBool;
begin
   fechar := false;
   SetForegroundWindow(Application.Handle);
{liga a trava}
   SystemParametersInfo(97, Word(True), @OldValue, 0);
   Top := 0;
   Left := 0;
   Width := Screen.Width;
   Height := Screen.Height;
end;

procedure TFrmprotec.FormCreate(Sender: TObject);
begin
   fechar := false;
end;

procedure TFrmprotec.FormCloseQuery(Sender: TObject;
  var CanClose: Boolean);
begin
   Canclose := fechar;
end;

end.



